package com.Java.cs;

public class UserServiceTest {
    public static void main(String[] args) {
        UserService userService = new UserServiceImpl();

        // 创建用户
        User user = new User();
        user.setName("张三");
        user.setUsername("zhangsan");
        user.setPassword("123456");

        // 测试注册
        boolean registerResult = userService.register(user);
        System.out.println("注册成功: " + registerResult); // 应输出true

        // 测试登录 - 正确的用户名和密码
        boolean loginSuccess = userService.login("zhangsan", "123456");
        System.out.println("登录成功: " + loginSuccess); // 应输出true

        // 测试登录 - 错误的密码
        boolean loginFail = userService.login("zhangsan", "wrongpassword");
        System.out.println("登录成功 (错误密码): " + loginFail); // 应输出false

        // 测试登录 - 错误的用户名
        boolean loginFailUsername = userService.login("wrongusername", "123456");
        System.out.println("登录成功 (错误用户名): " + loginFailUsername); // 应输出false
    }
}
